import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;


public class Solution6 {
    public static void main(String[] args) {
        Solution6 solution6 = new Solution6();
        List<List<Integer>> combine = solution6.combine(4, 2);

    }
    private List<List<Integer>> reultList = new ArrayList<List<Integer>>();
    int k;
    int n;
    public List<List<Integer>> combine(int n, int k) {
        if(k==0)return null;
        this.k = k;
        this.n = n;
        LinkedList<Integer> list = new LinkedList<>();
        _recurrent(1,1,list);
        return reultList;
    }
    private void _recurrent(int index,int level,LinkedList<Integer> list){
        if(level > k){
            reultList.add(new LinkedList<>(list));
            return;
        }
        for(int i=index;i<=n;i++){
            list.add(i);
            _recurrent(i+1,level+1,list);
            list.removeLast();
        }
        // 清理变量
    }
}
